<?php
/**
 * Created by PhpStorm.
 * User: zl
 * Date: 2017/5/11
 * Time: 11:19
 * 创建出差审批
 */
    require_once ('BusinessApp.php');
    require_once ('../Common.php');
    //获取所有POST数据
    $approvalData = $_POST;

    $result_array = array();
    if(!$approvalData){
        $result_array['state'] = 0;
        $result_array['state_error'] = 'POST_ERROR';
    }
    $b_app = new BusinessApp();

    $result = $b_app->createBusinessApprove($approvalData);


    //上传文件和上传数据分开处理，所以返回当前申请的ID
    if($result){
        $result_array['state'] = 1;
        $result_array['approval_id']= $result;
        $result_array['state_error'] = '';
    }
    else{
        $result_array['state'] = 0;
        $result_array['state_error'] = 'DB_ERROR';
    }

    echo json_encode($result_array);
?>